import { IFormProps, size, formItemLayout, getUploadResult, productPage, getImages, getFileList } from '../../utils/common';
import React from 'react';
import { Modal, Form, Input, Select, Upload, Checkbox,InputNumber } from 'antd';
import * as api from '../../api/api';
import { FormComponentProps } from 'antd/lib/form';
export interface IUserWalletChargeEditProps extends FormComponentProps {
    visible: boolean,
    onSave: (any) => void,
    onCancel: () => void,
}
class UserWalletChargeEdit extends React.PureComponent<IUserWalletChargeEditProps, any>{
    constructor(props) {
        super(props);
    }

    ok = (e) => {
        e.preventDefault();
        this.props.form.validateFieldsAndScroll((err, form) => {
            if (!err) {
                this.props.onSave(form);
            }
        });
    }

    cancel = () => {
        this.props.onCancel();
    }

    render(): JSX.Element {
        const { getFieldDecorator } = this.props.form;
        return (
            <Modal
                title='钱包充值金额'
                visible={this.props.visible}
                onOk={this.ok}
                onCancel={this.cancel}
                maskClosable={true}
            >
                <Form>
                    <Form.Item label="请输入金额" {...formItemLayout}>
                        {getFieldDecorator('amount', {
                            rules: [
                                {
                                    required: true,
                                    message: '请输入金额'
                                }
                            ]
                        })(<InputNumber size={size}
                             min={1}/>)}
                    </Form.Item>
                </Form>
            </Modal>)
    }
}

export default Form.create()(UserWalletChargeEdit);